<?php

class BaseMartModel extends BaseModel {
    private static $dwMart = null;
 
    protected static function getDwMartConnection()
    {
        if (self::$dwMart !== null) {
            return self::$dwMart;
        }
        else
        {
            self::$dwMart = Yii::app()->dwmart;
            if (self::$dwMart instanceof CDbConnection)
            {
                self::$dwMart->setActive(true);
                return self::$dwMart;
            }
            else {
                throw new CDbException(Yii::t('yii','Active Record requires a "db" CDbConnection application component.'));
            }
        }
    }
}